import { BattleRoleUI } from "../../roleUI/BattleRoleUI";
import { UITriggerType } from "../UITriggerType";
import { ActionBase } from "./ActionBase";

/**
 * 行动-走近目标
 */
export class WalkToTarget extends ActionBase {
    targetUI: BattleRoleUI;
    attackDic: number
    constructor(casterUI: BattleRoleUI, targetUI: BattleRoleUI, attackDic: number = 0) {
        super()
        this.casterUI = casterUI;
        this.targetUI = targetUI
        this.attackDic = attackDic
    }

    excute(): void {
        console.log("触发走近目标行为")
        this.casterUI.walkToPoint(this.targetUI.position, this.attackDic, () => {
            //回调触发攻击事件
            this.casterUI.UITriggerMgr.trigger(UITriggerType.attack_ui)
        })
    }
}